Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internals rewrite: clean up checks and hypothesis functionality #1109

Merged
merged 12 commits into from
Mar 13, 2023

Conversation

cosmicBboy
Copy link
Collaborator

This PR organizes the checks and hypothesis modules across the core and backend subpackages for overall consistency:

  • The pandera.core.{checks, hypotheses} module specifies the public-facing class API for checks and hypotheses. This provides a way for users to access built-in checks/hypotheses with full auto-completion on an IDE. These methods delegate to the builtin_{checks, hypotheses} modules.
  • The pandera.backends.base.builtin_{checks, hypotheses} modules implement base function implementations that use multimethod to dispatch the implementation to a specific data framework (e.g. pandera.backends.pandas.builtin_{checks, hypotheses}
  • Base function implementations are marked with @{Check, Hypothesis}.register_builtin_check_fn, and framework-specific implementations are marked with @register_builtin_{check, hypothesis}

This PR also cleans up the way SchemaErrors failure cases are handled. Instead of having pandas-specific logic in the SchemaErrors methods:

  • The failure_cases_metadata method was introduced in the BaseSchemaBackend class to handle consolidating and summarizing failure cases from across multiple checks.
  • Introduce a FailureCaseMetadata namedtuple class to clarify the metadata needed by SchemaErrors.

@codecov
Copy link

codecov bot commented Mar 12, 2023

Codecov Report

Patch coverage: 99.46% and project coverage change: +0.17 🎉

Comparison is base (76ed3f6) 97.23% compared to head (83ad473) 97.41%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1109      +/-   ##
==========================================
+ Coverage   97.23%   97.41%   +0.17%     
==========================================
  Files          63       67       +4     
  Lines        4710     4789      +79     
==========================================
+ Hits         4580     4665      +85     
+ Misses        130      124       -6     
Impacted Files Coverage Δ
pandera/backends/pandas/array.py 99.07% <ø> (ø)
pandera/core/pandas/__init__.py 100.00% <ø> (ø)
pandera/decorators.py 99.03% <ø> (-0.49%) ⬇️
pandera/extensions.py 0.00% <ø> (ø)
pandera/core/extensions.py 99.01% <97.14%> (+0.50%) ⬆️
pandera/core/checks.py 98.54% <99.04%> (+1.57%) ⬆️
pandera/__init__.py 88.23% <100.00%> (+0.35%) ⬆️
pandera/backends/__init__.py 100.00% <100.00%> (ø)
pandera/backends/base/__init__.py 100.00% <100.00%> (ø)
pandera/backends/base/builtin_checks.py 100.00% <100.00%> (ø)
... and 14 more

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@cosmicBboy
Copy link
Collaborator Author

this PR is part 2 in the effort to decouple pandas-specific validation logic from the pandera schema specification: #381

@cosmicBboy cosmicBboy deleted the clean-checks branch March 13, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant